import { App } from 'vue'
import { registerPanelItemProvider } from '@ibiz-template/runtime'

import { GridContainerProvider } from './grid-container/i-biz-grid-container.provider'
import { MultiDataContainerProvider } from './multi-data-container/i-biz-multi-data-container.provider'
import { MultiDataContainerRawProvider } from './multi-data-container-raw/i-biz-multi-data-container-raw.provider'
import { PanelContainerProvider } from './panel-container/i-biz-panel-container.provider'
import { PanelContainerGroupProvider } from './panel-container-group/i-biz-panel-container-group.provider'
import { PanelContainerImageProvider } from './panel-container-image/i-biz-panel-container-image.provider'
import { PanelContainerTabsProvider } from './panel-container-tabs/i-biz-panel-container-tabs.provider'
import { PanelFieldProvider } from './panel-field/i-biz-panel-field.provider'
import { PanelItemRenderProvider } from './panel-item-render/i-biz-panel-item-render.provider'
import { PanelRawItemProvider } from './panel-raw-item/i-biz-panel-raw-item.provider'
import { PanelTabPageProvider } from './panel-tab-page/i-biz-panel-tab-page.provider'
import { ScrollContainerItemProvider, ScrollContainerProvider } from './scroll-container/index'
import { SingleDataContainerProvider } from './single-data-container/i-biz-single-data-container.provider'
import { TeleportPlaceholderProvider } from './teleport-placeholder/i-biz-teleport-placeholder.provider'
import { AuthUserinfoProvider } from './auth-userinfo/i-biz-auth-userinfo.provider'
import { PanelButtonProvider } from './panel-button/i-biz-panel-button.provider'
import { ViewContentPanelContainerProvider } from './view-content-panel-container/i-biz-view-content-panel-container.provider'
import { ViewFooterPanelContainerProvider } from './view-footer-panel-container/i-biz-view-footer-panel-container.provider'
import { ViewHeaderPanelContainerProvider } from './view-header-panel-container/i-biz-view-header-panel-container.provider'

export const PanelComponentRegister = {
  install(v: App) {
    // 面板容器
    registerPanelItemProvider('CONTAINER_CONTAINER_GRID', () => new GridContainerProvider())
    // 多项数据容器
    registerPanelItemProvider(
      'CONTAINER_CONTAINER_MULTIDATA',
      () => new MultiDataContainerProvider(),
    )
    // 多项数据容器-仅数据布局容器
    registerPanelItemProvider(
      'CONTAINER_CONTAINER_MULTIDATA_RAW',
      () => new MultiDataContainerRawProvider(),
    )
    // 面板容器
    registerPanelItemProvider('CONTAINER', () => new PanelContainerProvider())
    registerPanelItemProvider('CONTAINER_DEFAULT', () => new PanelContainerProvider())
    // 面板分组容器
    registerPanelItemProvider('CONTAINER_CONTAINER_GROUP', () => new PanelContainerGroupProvider())
    // 面板图片容器
    registerPanelItemProvider('CONTAINER_CONTAINER_IMAGE', () => new PanelContainerImageProvider())
    // 面板分页容器
    registerPanelItemProvider('CONTAINER_TABS', () => new PanelContainerTabsProvider())
    // 面板属性
    registerPanelItemProvider('FIELD', () => new PanelFieldProvider())
    // 面板绘制器
    registerPanelItemProvider('PREDEFINE_RENDER', () => new PanelItemRenderProvider())
    // 直接内容
    registerPanelItemProvider('RAWITEM', () => new PanelRawItemProvider())
    registerPanelItemProvider('RAWITEM_STATIC_IMAGE', () => new PanelRawItemProvider())
    registerPanelItemProvider('RAWITEM_STATIC_LABEL', () => new PanelRawItemProvider())
    registerPanelItemProvider('RAWITEM_STATIC_TEXT', () => new PanelRawItemProvider())
    // 面板分页
    registerPanelItemProvider('TABPAGE', () => new PanelTabPageProvider())
    // 面板滚动条容器
    registerPanelItemProvider('CONTAINER_CONTAINER_SCROLL', () => new ScrollContainerProvider())
    // 面板滚动条容器项

    registerPanelItemProvider(
      'CONTAINER_CONTAINER_SCROLL_LEFT',
      () => new ScrollContainerItemProvider(),
    )
    registerPanelItemProvider(
      'CONTAINER_CONTAINER_SCROLL_HEADER',
      () => new ScrollContainerItemProvider(),
    )
    registerPanelItemProvider(
      'CONTAINER_CONTAINER_SCROLL_RIGHT',
      () => new ScrollContainerItemProvider(),
    )
    registerPanelItemProvider(
      'CONTAINER_CONTAINER_SCROLL_BOTTOM',
      () => new ScrollContainerItemProvider(),
    )
    registerPanelItemProvider(
      'CONTAINER_CONTAINER_SCROLL_MAIN',
      () => new ScrollContainerItemProvider(),
    )
    // 单项数据容器
    registerPanelItemProvider(
      'CONTAINER_CONTAINER_SINGLEDATA',
      () => new SingleDataContainerProvider(),
    )
    // 面板控件teleport占位
    registerPanelItemProvider(
      'RAWITEM_TELEPORT_PLACEHOLDER',
      () => new TeleportPlaceholderProvider(),
    )
    // 用户信息
    registerPanelItemProvider('RAWITEM_AUTH_USERINFO', () => new AuthUserinfoProvider())
    // 面板按钮
    registerPanelItemProvider('BUTTON', () => new PanelButtonProvider())
    // 视图内容区
    registerPanelItemProvider('CONTAINER_CONTENT', () => new ViewContentPanelContainerProvider())
    // 视图底部
    registerPanelItemProvider('CONTAINER_FOOTER', () => new ViewFooterPanelContainerProvider())
    // 视图头部
    registerPanelItemProvider('CONTAINER_HEADER', () => new ViewHeaderPanelContainerProvider())
  },
}

export default PanelComponentRegister
